local Game = {}


local resource_definitions = {
  background = {
    type = RESOURCE_TYPE_IMAGE,
    fileName = 'background/wizardtower.png',
    width = 1000, height = 700
  },
}

  function Game:start ()
    
    self:initialize()
    while(true) do
      self:processInput()
      coroutine.yield()
    end
    
  end
  
  function Game:processInput()
    x,y = inputManager:deltaPosition()
    self.camera:moveLoc ( x, 0, 0.5, MOAIEaseType.LINEAR )
  end
  
  
  




  
  function sleepCoroutine(time)
    local timer = MOAITimer.new()
    timer:setSpan(time)
    timer:start()
    MOAICoroutine.blockOnAction(timer)
  end

  
  
  function Game:initialize ()
    self.camera = MOAICamera2D.new()
    self.layer = MOAILayer2D.new()
    self.layer:setViewport(viewPort)
    self.layer:setCamera(self.camera)
    MOAIRenderMgr.setRenderTable({ self.layer })
    inputManager:initialize ()
    resourceDefinitions:setDefinitions(resource_definitions)
    self:loadBackground ()
  end
  
  function Game:loadBackground()
    self.background = {}
    self.background.deck = resourceManager:get('background')
    local prop = MOAIProp2D.new()
    prop:setDeck(self.background.deck)
    prop:setLoc(0, 0)
    self.background.prop = prop
    self.layer:insertProp(prop)
  end
  
  
  
  

return Game